1
The Course Performance Brief
DSAI2202Lab 5: Grouping and Summarising Data

The UniLearn registrar needs a course performance report for a fictional 2026 semester. Summarise active enrolments, including students whose scores are not yet available.

Prepare Your PostgreSQL Data

  1. Open your practice database in pgAdmin Query Tool. Turn Auto-commit on.
  2. Choose Open File and select the separately supplied lab5_setup.sql.
  3. Execute the whole file. It selects the lab5 schema. In the same Query Tool, copy the inspection query from Code and confirm 36 rows.

What Does One Row Mean?

One row is one student's enrolment in one course. S101 takes three courses, so S101 appears three times. An enrolment count and a student count can differ.

Build the Registrar's Report

  • Count enrolments, recorded scores, and distinct students.
  • Calculate totals and averages for each course.
  • Keep courses that meet the requested summary conditions.
💡 Read Before Summarising
NULL means no recorded score; 0 is a recorded score. Withdrawn enrolments remain in the table but are excluded from the report.

Preview: First 12 of 36 Enrolments

The full enrolments table contains 20 distinct students across six courses. Six withdrawn rows will be filtered out of the report. Run the inspection query to see all 36 rows.

EnrolmentStudentProgrammeCourseStatusScoreHours
E01S101DSAISQL101active806
E02S102CSSQL101active604
E03S103DSAISQL101activeNULL5
E04S104ITSQL101withdrawn902
E05S101DSAIPY101active908
E06S105CSPY101active506
E07S106DSAIPY101active707
E08S107ITPY101activeNULL3
E09S102CSVIS101active404
E10S108DSAIVIS101activeNULL2
E11S109ITVIS101withdrawn1001
E12S110ITVIS101active01

Read the Columns

  • enrolment_id identifies one enrolment; student_id may repeat.
  • score is a mark out of 100, or NULL if unrecorded.
  • study_hours records hours for this enrolment.
💡 PostgreSQL Syntax
Text values use single quotes. Numbers and SQL NULL do not. End each statement with a semicolon.